#!/bin/sh

SHELL_FOLDER=$(cd $(dirname ${BASH_SOURCE:-$0});pwd)
PROJECT_DIR=$(pwd)

BUILD=$1
VERSION=$2

source $SHELL_FOLDER/util.sh

# 更新配置
sh $SHELL_FOLDER/import.sh

# 清空缓存
flutter clean

# 编译
flutter build ipa --release

# DIST_DIR=dist/ios
# TIME_S=`date +%s`
# IPA_NAME=Runner_$TIME_S.ipa
# cp -rf 

# cd $PROJECT_DIR
# echo "打包成功：$PROJECT_DIR/$DIST_DIR/$IPA_NAME"

# 这里可以写上传到对应的服务端（例如蒲公英、App Store等）之类的功能
# https://help.apple.com/asc/appsaltool/#/apdATD1E53-D1E1A1303-D1E53A1126
# API_KEY=
# ISSUSER_ID=
# xcrun altool --upload-app --type ios -f "$DIST_DIR/$IPA_NAME" --apiKey $API_KEY --apiIssuer $ISSUSER_ID
